<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:cc="http://java.sun.com/jsf/composite"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core"> 
    <f:view>
        <p:themeSwitcher initialText="Change Skin" buttonPreText="Skin: "/>
        <h:form>
            
            
            <p:menu type ="tiered">
                <p:menuitem value="Home" url="/index.xhtml"/>

                <p:submenu label="CRM" rendered="#{loginBacking.crmMenu}">
                    <p:submenu label="Sales Lead" rendered="#{loginBacking.salesLeadMenu}">  
                        <p:menuitem action="#{salesLeadEntityController.prepareCreate}" value="New Sales Lead" rendered="#{loginBacking.addSalesLead}" />
                        <p:menuitem url="/entities/salesLeadEntity/List.xhtml" value="Show All Sales Leads" rendered="#{loginBacking.viewAllSalesLead}"/>

                        <p:menuitem url="/entities/salesLeadEntity/SalesLeadHistory.xhtml" value="View Sales Lead History" rendered="#{loginBacking.viewSalesLeadHistory}"/>

                    </p:submenu>
                    <p:submenu label="Customer" rendered="#{loginBacking.customerMenu}">
                        <p:menuitem action="#{customerEntityController.prepareCreate}" value="New Customer" rendered="#{loginBacking.addCustomer}"/>
                        <p:menuitem url="/entities/customerEntity/List.xhtml" value="Show All Customers" rendered="#{loginBacking.viewAllCustomer}"/>
                        <p:menuitem url="/entities/customerEntity/CustomerHistory.xhtml" value="View Customer History" rendered="#{loginBacking.viewCustomerHistory}"/>
                        <p:menuitem url="/entities/customerEntity/CustomerExecutiveCustomersList.xhtml" value="Show All Executive's Customers" rendered="#{loginBacking.viewCustomerExecutiveCustomers}"/>
                    </p:submenu>
                </p:submenu>

                

                <p:submenu label="Raw Material Purchasing" rendered="#{loginBacking.purchasing}">
                    <p:menuitem url="/entities/purchasing/ListSupplier.xhtml" value="Manage Current  Suppliers"  rendered="#{loginBacking.listSupplier}"/>
                    <p:menuitem url="/entities/purchasing/AddSupplier.xhtml" value="Add New Supplier" rendered="#{loginBacking.addSupplier}"  />

                    <p:menuitem url="/entities/purchasing/PurchaseRequisition.xhtml" value="Create Purchase Requisition" rendered="#{loginBacking.createPurchaseRequisition}" />
                    <p:menuitem url="/entities/purchasing/MaintainQuotation.xhtml" value="Maintain Quotation" rendered="#{loginBacking.maintainQuotation}"/>
                    <p:menuitem url="/entities/purchasing/PriceComparison.xhtml" value="Initiate Order" rendered="#{loginBacking.initiateOrder}"  />
                    <p:menuitem url="/entities/purchasing/EditOrder.xhtml" value="Update Order Detail" rendered="#{loginBacking.updateOrder}"/>

                    <p:menuitem url="/entities/purchasing/AcknowledgeOrder.xhtml" value="Maintain Ongoing Order" rendered="#{loginBacking.acknowledgeNewOrder}"/>


                    <p:menuitem url="/entities/purchasing/PastOrder.xhtml" value="View Completed Order" rendered="#{loginBacking.viewCompletedOrder}" />
                </p:submenu>
                <p:submenu label="Sales" rendered="#{loginBacking.sales}">
                    <p:submenu label="Sales Inquiries">
                        <p:menuitem action="#{salesInquiryEntityController.prepareCreate}" value="New Sales Inquiry" rendered="#{loginBacking.addSalesInquiry}" />
                        <p:menuitem action="#{salesInquiryEntityController.prepareList}" value="Show All Sales Inquiry" rendered="#{loginBacking.viewAllSalesInquiry}" />
                        <p:menuitem action="#{salesInquiryEntityController.prepareSearchForm}" value="Search Sales Inquiry" rendered="#{loginBacking.searchSalesInquiry}" />
                    </p:submenu>

                    <p:submenu label="Sales Quotation">
                        <p:menuitem action="#{salesQuotationEntityController.prepareCreate}" value="New Sales Quotation" rendered="#{loginBacking.addSalesQuotation}"/>
                        <p:menuitem action="#{salesQuotationEntityController.prepareList}" value="Show All Sales Quotation" rendered="#{loginBacking.viewAllSalesQuotation}"/>
                        <p:menuitem url="/entities/salesQuotationEntity/Search.xhtml" value="Search Sales Quotation" rendered="#{loginBacking.searchSalesQuotation}"/>
                    </p:submenu>


                    <p:submenu label="Purchase Order">
                        <p:menuitem action="#{purchaseOrderEntityController.prepareList}" value="Show All Purchase Order" rendered="#{loginBacking.viewAllPurchaseOrder}"/>
                        <p:menuitem url="/entities/purchaseOrderEntity/Search.xhtml" value="Search Purchase Orders" rendered="#{loginBacking.searchPurchaseOrder}"/>
                    </p:submenu>

                    <p:submenu label="Sales Order">
                        <p:menuitem action="#{salesOrderEntityController.prepareList}" value="Show All Sales Order" rendered="#{loginBacking.viewAllSalesOrder}"/>
                        <p:menuitem url="/entities/salesOrderEntity/Search.xhtml" value="Search Sales Orders" rendered="#{loginBacking.searchSalesOrder}"/>
                        <p:menuitem url="/entities/priceListEntity/List.xhtml" value="Show All Price List" rendered="#{loginBacking.viewAllPriceList}"/> 
                        <p:menuitem url="/entities/saleOrderReportEntity/List.xhtml" value="Sales Order Report" rendered="#{loginBacking.viewAllSalesOrderReport}"/>
                    </p:submenu>
                </p:submenu>

                <p:submenu label="Inventory Management" rendered="#{loginBacking.viewCGInventoryMenu}">
                    <p:menuitem action="#{batchEntityController.prepareCreate}" value="Enter New Batch" rendered="#{loginBacking.addNewBatch}" />
                    <p:submenu label="Completed Goods">
                        <p:menuitem action="#{completedGoodsLocationEntityController.prepareCompletedGoodsByLocation}" 
                                    value="Completed Goods Inventory Overview" rendered="#{loginBacking.viewCGInventoryOverview}" />
                        <p:menuitem action="#{batchEntityController.prepareCompletedGoodsLog}" 
                                    value="Show Completed Goods Log" rendered="#{loginBacking.viewCGInventoryLog}" />
                        <p:menuitem action="#{reservationEntityController.prepareList}" 
                                    value="Show all reservations" rendered="#{loginBacking.viewAllReservations}" />
                        <p:menuitem action="#{pickingOrderEntityController.prepareList}" 
                                    value="Show all picking orders" rendered="#{loginBacking.viewAllPickingOrders}" />
                        <p:menuitem url="/entities/shippingOrderEntity/List.xhtml" 
                                    value="Show all shipping orders" rendered="#{loginBacking.listShippingOrder}" />
                    </p:submenu>
                    
                    <p:submenu label="Raw Material" rendered="#{loginBacking.viewRMInventoryMenu}">
                      <p:menuitem action="#{rawMaterialEntityController.prepareRawMaterialByLocation}" 
                                  value="Raw Materials Inventory Overview" rendered="#{loginBacking.viewRMInventoryOverview}" />
                      <p:menuitem action="#{batchEntityController.prepareRawMaterialsLog}" 
                                  value="Show Raw Materials Log" rendered="#{loginBacking.viewRMInventoryLog}" />
                      <p:menuitem url="/entities/rawMaterialEntity/RawMaterialOutbound.xhtml" 
                                  value="Raw Material Removal" rendered="#{loginBacking.outBoundRM}" />
                    </p:submenu>
                    
                    <p:menuitem value="Inventory Utilization Report" action="#{jasper.generateInventoryReport}" ajax="false" rendered="#{loginBacking.inventoryUtilizationReport}" />
                </p:submenu>

                <p:submenu label="Accounts Payable" rendered="#{loginBacking.accountPayable}" >
                    <p:submenu label="Vendor Payment" >
                    <p:menuitem url="/entities/purchasing/NewInvoice.xhtml" value="Maintain New Invoice" rendered="#{loginBacking.maintainNewInvoice}"/>
                    <p:menuitem url="/entities/purchasing/PostPayment.xhtml" value="Post Invoice Payment" rendered="#{loginBacking.postInvoice}" />
                    </p:submenu>
                    <p:submenu label="Refund" rendered="#{loginBacking.refund}">
                        <p:menuitem url="/entities/refundRequestEntity/ListUnprocessed.xhtml" value="Process Refund Requests"/>
                        <p:menuitem url="/entities/refundRequestEntity/List.xhtml" value="All Refund Requests"/>
                    </p:submenu>
                </p:submenu>

                <p:submenu label="Accounts Receivable" rendered="#{loginBacking.accountsReceivable}">
                    <p:submenu label="Customer Account" rendered="#{loginBacking.customerAccount}">
                        <p:menuitem url="/entities/customerAccountEntity/NoAccountCustomersList.xhtml" value="Assign Customer Account" rendered="#{loginBacking.assignCustomerAccount}"/>
                        <p:menuitem url="/entities/customerAccountEntity/List.xhtml" value="All customer accounts" rendered="#{loginBacking.listCustomerAccount}"/>
                    </p:submenu>
                    <p:submenu label="Billing Request" rendered="#{loginBacking.billingRequest}">
                        <p:menuitem url="/entities/billingRequestEntity/ListCIA.xhtml" value="Cash-in-Advance Billing Requests"/>
                        <p:menuitem url="/entities/billingRequestEntity/ListNormal.xhtml" value="Normal Billing Requests"/>
                    </p:submenu>

                    <p:submenu label="Invoice" rendered="#{loginBacking.invoice}">
                        <p:menuitem url="/entities/customerInvoiceEntity/ListUnposted.xhtml" value="Post Invoice"/>
                        <p:menuitem url="/entities/customerInvoiceEntity/ListCIA.xhtml" value="Cash-in-Advance Invoices"/>
                        <p:menuitem url="/entities/customerInvoiceEntity/ListNormal.xhtml" value="Normal Invoices"/>
                        <p:menuitem url="/entities/customerInvoiceEntity/ListReminder.xhtml" value="Reminder Invoices"/>
                        <p:menuitem url="/entities/customerInvoiceEntity/List.xhtml" value="All Invoices"/>
                    </p:submenu>
                    <p:submenu label="Payment" rendered="#{loginBacking.payment}">
                        <p:menuitem url="/entities/customerInvoiceEntity/ListUnpaid.xhtml" value="Record Payment"/>
                        <p:menuitem url="/entities/paymentEntity/ListCIA.xhtml" value="Cash-in-Advance Payments"/>
                        <p:menuitem url="/entities/paymentEntity/ListNormal.xhtml" value="In-time Payments"/>
                        <p:menuitem url="/entities/paymentEntity/ListLate.xhtml" value="Late Payments"/>
                        <p:menuitem url="/entities/paymentEntity/List.xhtml" value="All Payments"/>
                    </p:submenu>
                    
                    <p:menuitem action="#{customerInvoiceEntityController.generateRevenueReport()}" value="Monthly Revenue" ajax="false"/>
                </p:submenu>

                <p:submenu label="Sales Planning" rendered="#{loginBacking.salesPlanning}">
                    <p:menuitem url="/entities/salesForecastEntity/Create.xhtml" value="Sales Forecasting" rendered="#{loginBacking.viewAllSalesForecast}"/>
                    <p:menuitem action="#{expectedYearOnYearGrowthEntityController.prepareListMarketSalesReport}" value="Market SalesReport Management" rendered="#{loginBacking.viewAllMarketSalesReports}"/>
                </p:submenu>

                <p:submenu label="Production Planning" rendered="#{loginBacking.productionPlanning}">
                    <p:menuitem action="#{masterProductionScheduleMonthlyEntityController.prepareList}" value="Sales Operation Planning" rendered="#{loginBacking.listProductionPlan}" ajax="false"/>
                    <p:menuitem action="#{masterProductionScheduleDailyEntityController.prepareList}" value="Daily Demand Management" rendered="#{loginBacking.listProductionPlan}" ajax="false"/>
                    <p:menuitem action="#{masterProductionScheduleWeeklyEntityController.prepareList}" value="Weekly Demand Management" rendered="#{loginBacking.listProductionPlan}" ajax="false"/>
                    <p:menuitem action="#{calendarEntityController.prepareList}" value="Public Holidays Management" ajax="false" rendered="#{loginBacking.publicHoliday}"/>
                    <p:menuitem action="#{rawMaterialRequirementWeeklyEntityController.prepareList}" value="Material Requirement Planning" rendered="#{loginBacking.listMRPS}"/>
                    <p:menuitem action="#{backorderEntityController.prepareList}" value="Unplanned Production Management" rendered="#{loginBacking.listAllBackOrders}"/>
                    <p:menuitem action="#{completedGoodsEntityController.prepareList}" value="Completed Goods Management" rendered="#{loginBacking.listAllCompletedGoods}"/>
                    <p:menuitem action="#{rawMaterialEntityController.prepareList}" value="Raw Materials Management" rendered="#{loginBacking.listAllRawMaterials}"/>
                </p:submenu>


                <p:submenu label="Admin Section" rendered="#{loginBacking.admin}">>
                    <p:submenu label="Access Control">
                        <p:menuitem url="/roles/Department.xhtml" value="User Roles" rendered="#{loginBacking.assignRole}"/>
                        <p:menuitem url="/roles/ViewRight.xhtml" value="User Rights" rendered="#{loginBacking.assignRight}"/>
                        <p:menuitem url="/roles/EditRoles.xhtml" value="Role Rights" rendered="#{loginBacking.modifyRoles}"/>
                        <p:menuitem url="/roles/UnlockUser.xhtml" value="Unlock User" rendered="#{loginBacking.unlockUser}"/>

                    </p:submenu>
                    <p:submenu label="Employee Management" rendered="#{loginBacking.employeeManagementMenu}">
                        <p:menuitem action="#{systemUserEntityController.prepareCreate}" value="New Employee" rendered="#{loginBacking.createSystemUser}"/>
                        <p:menuitem action="#{systemUserEntityController.prepareSearch}" value="Search Employees" rendered="#{loginBacking.searchSystemUser}"/>
                        <p:menuitem action="#{systemUserEntityController.prepareList}" value="Show All Employees" rendered="#{loginBacking.listSystemUser}"/>                       
                    </p:submenu>
                    <p:submenu label="Static Items" rendered="#{email.checkSystemUser()}">
                        <p:menuitem url="/entities/departmentEntity/List.xhtml" value="Show All Department"/>
                    </p:submenu>
                </p:submenu>
                
                <p:submenu label="Communication" rendered="#{loginBacking.communicationMenu or email.checkSystemUser()}">
                    <p:menuitem value="User Message(#{userMessageController.totalUnread})" action="#{userMessageController.discardAndRediret}" rendered="#{loginBacking.viewUserMessage}" ajax="false"/>
                    <p:menuitem value="Announcement(#{announcementController.totalUnread})" action="#{announcementController.discardAndRediret}" rendered="#{loginBacking.viewAnnouncement}" ajax="false"/>
                    <p:menuitem url="/email.xhtml" actionListener="#{email.emptyFields}" value="Email" rendered="#{email.checkSystemUser()}"/>
                </p:submenu>
            </p:menu>
        </h:form>
    </f:view> 

</ui:composition>
